/*
* File :
* Created : 17 janv. 07
* By : eSpider Team
* Version : $Revision$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details ( see the LICENSE file ).
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

package org.fbmc.file;

import java.io.File;
import java.sql.Date;

public final class ImageFile extends MediaFile {
	
	private String event;
	private Date dateEvent;
	
	public ImageFile() {
		event = "";
		dateEvent = new Date(0);
	}
	
	public ImageFile(File file) {
		super(file);
		
		event = "";
		dateEvent = new Date(0);
	}
	
	@Override
	public Type getType() {
		return MediaFile.Type.image;
	}

	public Date getDateEvent() {
		return dateEvent;
	}

	public void setDateEvent(Date dateEvent) {
		this.dateEvent = dateEvent;
	}

	public String getEvent() {
		return event;
	}

	public void setEvent(String event) {
		this.event = event;
	}
	
	public int compareTo(MediaFile mediaFile) {
		if(super.compareTo(mediaFile) == 0){
			ImageFile file = (ImageFile)mediaFile;
			
			if(this.dateEvent.equals(file.getDateEvent())) return -1;
			if(!this.event.equals(file.getEvent())) return -1;
					
		}		
		return 0;
	}
}
 